<template>
    <p>登入页</p>
    <div>
        账号：<input type="text" v-model="account" placeholder="请输入您的账号">
    </div>
    <div>
        密码：<input type="password" v-model="password" placeholder="请输入您的密码">
    </div>
<div>
    <button @click="sumbit">登入</button>
</div>

</template>

<script setup>
import { ref } from "vue";
import {useStore} from 'vuex'
import {useRouter} from 'vue-router'


const store=useStore()

const router=useRouter()

const account = ref('admin')
const password = ref('123456')

const sumbit = () => {
    if(account.value === 'admin' && password.value=== '123456'){
        alert('登入成功')

        store.commit("updateUserInfo",{
            name:'张三',
            gender:'男',
            phone:'1345555555'

        })
        router.push({path:'/user'})

    }else{
        alert("账号或密码错误，请重新登录")
    }
}

</script>